<template>
  <BasicModal
    v-bind="$attrs"
    @register="register"
    title=""
    :footer="null"
    :width="1200"
    :height="680"
    :destroyOnClose="true"
    wrapClassName="stationPopup"
    @height-change="handleHeightChange"
  >
    <a-tabs v-model:activeKey="state.tabActive">
      <a-tab-pane key="1" tab="过程线">
        <Hydrograph :data="state.tableRowData" v-if="state.tabActive ==='1'" />
      </a-tab-pane>
      <a-tab-pane key="4" tab="测站信息">
        <StationInfo :data="state.tableRowData" v-if="state.tabActive ==='4'" />
      </a-tab-pane>
      <!-- <a-tab-pane key="5" tab="设备信息">
        <DeviceInfo :data="state.tableRowData" v-if="state.tabActive ==='5'" />
      </a-tab-pane> -->
    </a-tabs>
  </BasicModal>
</template>

<script lang="ts" setup>
  import { ref, reactive, provide } from 'vue';
  import { BasicModal, useModalInner } from '@gui-pkg/antdcomponents';
  import Hydrograph from './hydrograph.vue';
  import StationInfo from './stationInfo.vue';
  import DeviceInfo from './deviceInfo.vue';

  const modalHeightValue = ref(680);
  const state = reactive({
    stationName: '',
    tabActive: '1',
    tableRowData: null,
  });

  const [register, { setModalProps }] = useModalInner(async (data) => {
    setModalProps({ confirmLoading: false });
    state.tableRowData = data.record;
    state.tabActive = '1';
  });

  // 弹窗高度变化，主要是监听是否点击了全屏
  const handleHeightChange = (height: string) => {
    modalHeightValue.value = height;
  };
  provide('ModalHeightChange', modalHeightValue);

</script>

<style lang="less" rel="stylesheet/less" scoped>

</style>
